<?php

namespace App\Http\Controllers\H5;

use App\Library\Mall\SoldTrait;
use App\Models\Order;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class SoldController extends BaseController
{
    use SoldTrait;

    public function index()
    {

    }

    public function detail()
    {
        $order_id = $this->request->input('order_id');
        //$order = $this->user()->solds()->find($order_id);
        $order = Order::find($order_id);
        if ($order) {
            $trade = $order->trade;
            $shipping = $order->shipping;
            $items = $order->items;

            return $this->view('h5.sold.detail', compact('order_id', 'order', 'trade', 'shipping', 'items'));
        } else {
            return ajaxError(404, 'order not found');
        }
    }
}
